package cn.demoncat.util.lang.entity.data;

/**
 * 边
 * 
 * @author 延晓磊
 *
 * @since 2020年7月28日
 */
public class Edge<E,W extends Comparable<W>> implements Comparable<Edge<E,W>> {

	// 起点
	private E start;
	// 终点
	private E end;
	// 权值
	private W weight;
	
	public Edge() {
		super();
	}
	
	/**
	 * 构建
	 * 
	 * @param start		起点
	 * @param end		终点
	 * @param weight	权值
	 * 
	 * @author 延晓磊
	 *
	 * @since 2020年7月28日
	 */
	public Edge(E start, E end, W weight) {
		super();
		this.start = start;
		this.end = end;
		this.weight = weight;
	}

	public E getStart() {
		return start;
	}
	public void setStart(E start) {
		this.start = start;
	}
	public E getEnd() {
		return end;
	}
	public void setEnd(E end) {
		this.end = end;
	}
	public W getWeight() {
		return weight;
	}
	public void setWeight(W weight) {
		this.weight = weight;
	}

	@Override
	public String toString() {
		return "Edge [start=" + start + ", end=" + end + ", weight=" + weight + "]";
	}

	@Override
	public int compareTo(Edge<E, W> o) {
		return this.weight.compareTo(o.weight);
	}
	
}
